package com.example.juc.hashmap;

import lombok.extern.slf4j.Slf4j;

@Slf4j
public class Test1 {
    static volatile boolean b = false;

    public static void main(String[] args) throws InterruptedException {

        for (int i = 0; i < 10; i++) {
            new Thread(() -> {
                while (true) {
                    //System.out.println(b);
                    if (b) {
                        log.info("b:{}", b);
                        break;
                    }
                }
            }, "t" + i).start();
        }
        Thread.sleep(2000);
        new Thread(() -> {
            b = true;
            log.info("b:{}", b);
        }, "ttt").start();
    }

}
